package pl.perseus.action;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import pl.perseus.model.enums.DegreeType;
import lombok.Getter;
import lombok.Setter;

public class GetDegreeTypeAction extends BaseAction {

	@Getter
	@Setter
	Map<String, Object> result;
	
	@Override
	public String execute() {
		result = new HashMap<String, Object>();
		List<Map<String, String>> items = new LinkedList<Map<String, String>>();
		for(DegreeType d : DegreeType.values()){
			Map<String, String> degreeTypeMap = new HashMap<String, String>();
			degreeTypeMap.put("id", d.getType());
			degreeTypeMap.put("name", d.getType());
			
			items.add(degreeTypeMap);
		}
		
		result.put("identifier", "id");
		result.put("items", items);
		
		return SUCCESS;
	}

}
